/**
 * 订单相关API
 */

import {
	request,
	Method
} from "@/utils/request.js";


/**
 * 创建订单
 * @param params
 */
export function orderCreate(params) {
	return request({
		url: "/api/order/create",
		method: Method.POST,
		params,
	});
}

/**
 * 创建支付
 * @param params
 */
export function paymentCreate(params) {
	return request({
		url: "/api/order/createPayment",
		method: Method.POST,
		params,
	});
}


/**
 * 订单列表
 * @param params
 */
export function getOrderList(params) {
	return request({
		url: "/api/order/index",
		method: Method.GET,
		params,
	});
}

/**
 * 取消订单
 * @param params
 */
export function cancelOrder(params) {
	return request({
		url: "/api/goods/cancelOrder",
		method: Method.POST,
		params,
	});
}


/**
 * 订单详情
 * @param params
 */
export function getOrderDetail(params) {
	return request({
		url: "/api/order/detail",
		method: Method.GET,
		params,
	});
}

/**
 * 合同详情
 * @param params
 */
export function contractDetail(params) {
	return request({
		url: "/api/contract/detail",
		method: Method.GET,
		params,
	});
}

/**
 * 获取签署链接
 * @param params
 */
export function getSignUrl(params) {
	return request({
		url: "/api/order/getSignUrl",
		method: Method.GET,
		params,
	});
}

/**
 * 渲染HTML合同模板
 * @param params
 */
export function renderContract(params) {
	return request({
		url: "/api/order/renderContract",
		method: Method.GET,
		params,
	});
}

/**
 * 归还商品
 * @param params
 */
export function returnGoods(params) {
	return request({
		url: "/api/goods/returnGoods",
		method: Method.POST,
		params,
	});
}


/**
 * 续租商品
 * @param params
 */
export function renewalOrder(params) {
	return request({
		url: "/api/order/renew",
		method: Method.POST,
		params,
	});
}

/**
 * 买断商品
 * @param params
 */
export function buyoutOrder(params) {
	return request({
		url: "/api/goods/buyoutOrder",
		method: Method.POST,
		params,
	});
}

/**
 * 确认收货
 * @param params
 */
export function confirmReceive(params) {
	return request({
		url: "/api/order/confirmReceive",
		method: Method.POST,
		params,
	});
}

/**
 * 生成支付宝小程序二维码
 * @param params
 */
export function createAlipayMiniQrcode(params) {
	return request({
		url: "/api/user/createAlipayMiniQrcode",
		method: Method.POST,
		params,
	});
}

/**
 * 续租创建支付
 * @param params
 */
export function renewPay(params) {
	return request({
		url: "/api/order/renew",
		method: Method.POST,
		params,
	});
}

/**
 * 设置用户签名并签署
 * @param params
 */
export function signByImage(params) {
	return request({
		url: "/api/order/signByImage",
		method: Method.POST,
		params,
	});
}